package com.haowan123.qinmeiren.appota2;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

public class CollectionStaggeredAdapter extends ArrayAdapter<String> {

	
	public CollectionStaggeredAdapter(Context context, int textViewResourceId,
			String[] objects) {
		super(context, textViewResourceId, objects);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder holder;

		if (convertView == null) {
			LayoutInflater layoutInflator = LayoutInflater.from(getContext());
			convertView = layoutInflator.inflate(R.layout.row_staggered_colls,
					null);
			holder = new ViewHolder();
			holder.imageView = (ScaleImageView) convertView .findViewById(R.id.collImg);
			convertView.setTag(holder);
		}

		holder = (ViewHolder) convertView.getTag();
		holder.imageView.setImageResource(ImageResouces.list_thumbs[position]);
		return convertView;
	}

	static class ViewHolder {
		ScaleImageView imageView;
	}
	@Override
	public int getCount() {
		return ImageResouces.list.length;
	}
}
